<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>AdminLTE 2 | Dashboard</title>

    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">


    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" th:href="@{/bower_components/bootstrap/dist/css/bootstrap.min.css}" type="text/css">

    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/bower_components/font-awesome/css/font-awesome.min.css}" type="text/css">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/bower_components/Ionicons/css/ionicons.min.css}" type="text/css">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/dist/css/AdminLTE.min.css}" type="text/css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" th:href="@{/dist/css/skins/_all-skins.min.css}" type="text/css">
    <!-- Morris chart -->
    <link rel="stylesheet" th:href="@{/bower_components/morris.js/morris.css}" type="text/css">
    <!-- jvectormap -->
    <link rel="stylesheet" th:href="@{/bower_components/jvectormap/jquery-jvectormap.css}" type="text/css">
    <!-- Date Picker -->
    <link rel="stylesheet" th:href="@{/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css}"
          type="text/css">
    <!-- Daterange picker -->
    <link rel="stylesheet" th:href="@{/bower_components/bootstrap-daterangepicker/daterangepicker.css}" type="text/css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" th:href="@{/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css}" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
<div class="wrapper">

    <header class="main-header">
        <div th:include="common/head :: head"></div>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">

            <div th:include="common/left :: left"></div>
        </section>
        <!-- /.sidebar -->
    </aside>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper" id="impl">

        <div class="row" style="margin-top: 5px;">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">发信内容</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->

                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">发信人：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control"
                                           th:value="${message.sendname}" disabled>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">内容:</label>
                                <div class="col-sm-10">
                                    <textarea class="form-control" rows="3" th:text="${message.sendcontent}"
                                              name="describe" disabled></textarea>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发送时间:</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control"
                                           th:value="${message.sendtime}" disabled>

                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <!-- /.box-footer -->

                </div>
            </div>
        </div>
        <div class="row" style="margin-top: 25px;">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">回复消息</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form action="/recemessage" method="post" id="myform">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">收信人：</label>
                                <div class="col-sm-10">
                                    <!--发信人id-->
                                    <input type="hidden" class="form-control"
                                           th:value="${message.receiveid}"  name="sendid">
                                    <!--收信人id-->
                                    <input type="hidden" class="form-control"
                                           th:value="${message.sendid}" name="receiveid">
                                    <input type="hidden" class="form-control"
                                           th:value="${message.messageid}" name="messageid" >
                                    <input type="text" class="form-control" id="inputEmail3"
                                           th:value="${message.sendname}" name="sendname" disabled>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发信内容:</label>
                                <div class="col-sm-10">
                                    <textarea class="form-control" rows="3" placeholder="输入消息内容..."
                                              name="sendcontent"></textarea>

                                    <span id="spandescribe"></span>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="button" onclick="back()" class="btn btn-default">返回</button>
                            <button type="submit" class="btn btn-info pull-right" id="save" onclick="savesub()">确认
                            </button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>


    </div>
    <!-- /.content-wrapper -->
    <footer class="main-footer">
        <div th:include="common/footer :: footer"></div>
    </footer>
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script th:src="@{/bower_components/jquery/dist/jquery.min.js}" type="text/javascript"></script>
<!-- jQuery UI 1.11.4 -->
<script th:src="@{/bower_components/jquery-ui/jquery-ui.min.js}" type="text/javascript"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.7 -->
<script th:src="@{/bower_components/bootstrap/dist/js/bootstrap.min.js}" type="text/javascript"></script>
<!-- Morris.js charts -->
<script th:src="@{/bower_components/raphael/raphael.min.js}" type="text/javascript"></script>
<script th:src="@{/bower_components/morris.js/morris.min.js}" type="text/javascript"></script>
<!-- Sparkline -->
<script th:src="@{/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js}" type="text/javascript"></script>
<!-- jvectormap -->
<script th:src="@{/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js}" type="text/javascript"></script>
<script th:src="@{/plugins/jvectormap/jquery-jvectormap-world-mill-en.js}" type="text/javascript"></script>
<!-- jQuery Knob Chart -->
<script th:src="@{/bower_components/jquery-knob/dist/jquery.knob.min.js}" type="text/javascript"></script>
<!-- daterangepicker -->
<script th:src="@{/bower_components/moment/min/moment.min.js}" type="text/javascript"></script>
<script th:src="@{/bower_components/bootstrap-daterangepicker/daterangepicker.js}" type="text/javascript"></script>
<!-- datepicker -->
<script th:src="@{/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js}"
        type="text/javascript"></script>
<!-- Bootstrap WYSIHTML5 -->
<script th:src="@{/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js}" type="text/javascript"></script>
<!-- Slimscroll -->
<script th:src="@{/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}" type="text/javascript"></script>
<!-- FastClick -->
<script th:src="@{/bower_components/fastclick/lib/fastclick.js}" type="text/javascript"></script>
<!-- AdminLTE App -->
<script th:src="@{/dist/js/adminlte.min.js}" type="text/javascript"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script th:src="@{/dist/js/pages/dashboard.js}" type="text/javascript"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/dist/js/demo.js}" type="text/javascript"></script>
<script th:src="@{/js/UploadCommon.js}" type="text/javascript"></script>


<script type="text/javascript">
    $(function () {
        $('.sidebar-menu li:not(.treeview) > a').on('click', function () {
            console.log(this.href);
            var $parent = $(this).parent().addClass('active');
            $parent.siblings('.treeview.active').find('> a').trigger('click');
            $parent.siblings().removeClass('active').find('li').removeClass('active');
        });
        $('.sidebar-menu a').each(function () {
            if (this.href === window.location.href) {
                $(this).parent().addClass('active')
                    .closest('.treeview-menu').addClass('.menu-open')
                    .closest('.treeview').addClass('active');
            }
        });
    });
</script>


<script type="text/javascript">
    //描述不为空验证，注意与表单不一样，不能比较val()值。
    $("[name=sendcontent]").blur(function () {
        if ($("[name=sendcontent]").val() != "") {
            $("[name=sendcontent]").next().text("");
        } else {
            $("[name=sendcontent]").next().text("不能为空").css("color", "red");
        }
    });
    /*保存操作*/
    function savesub() {

        //拿到表单的值
        var describe=$("[name=sendcontent]").val();




        //拿到表单附近的span的判断值
        var spandescribe=$("#spandescribe").text();


        //如果input内容为空阻断提交  如何input后面的span判断有字说明不符合要求，阻断提交
        if (describe == ""||spandescribe!="") {
            $("#myform").bind("submit", (function (e) {
                e.preventDefault();
            }));
            confirm("输入的信息有误，请重新检查");
            return false;
        } else {
            var r=confirm("确认提交？");
            if(r==true){
                $("#myform").unbind("submit");
            }else{

            }
        }
    }

    //返回操作
    function back() {
        window.location.href="/tomessageadminindex";

    }


</script>


<script type="text/javascript">
    <!--下个页面独有的js-->
    var i=[[${i}]];
    if(i==1){
        alert("提交成功！");
        $("#save").attr('disabled',"true");
    }else {
        alert("提交失败，已经申请过，正在处理中！");
    }
</script>


</body>
</html>
